#include <iostream>
#include <vector>
#include <string>
using namespace std;

bool check(string s, vector<int> points) {
    int a = points[0], b = points[1], c = points[2];
    string aa = s.substr(0, a);
    string bb = s.substr(a, b - a);
    string cc = s.substr(b, c - b);
    string dd = s.substr(c);

    // cout << "aa: " << aa << endl;
    // cout << "bb: " << bb << endl;
    // cout << "cc: " << cc << endl;
    // cout << "dd: " << dd << endl;

    // lambda表达式验证每个部分是否合法
    auto isValid = [](const string& part) {
        if (part.empty() || part.size() > 3) return false;
        if (part[0] == '0' && part.size() > 1) return false; // leading zero
        int val = stoi(part);
        return val >= 0 && val <= 255;
    };

    return isValid(aa) && isValid(bb) && isValid(cc) && isValid(dd);
}

int main() {
    cout << check("25525511135", {3, 6, 9}) << endl;
    cout << check("0010010", {2, 3, 5}) << endl;
    return 0;
}
